package com.zpark.web.filter;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import java.io.IOException;

/**
 * @PackageName: com.zpark.web.filter
 * @ClassName: MyFilter01
 * @Description:
 * @author: RZS
 * @date: 2022/9/27  10:18
 */
@WebFilter("*.do")
public class MyFilter01 implements Filter {
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        System.err.println("过滤器初始化成功");
    }

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
        System.err.println("请求经过过滤器");
        // 放行，访问后续资源
        chain.doFilter(request, response);
    }

    @Override
    public void destroy() {
        System.err.println("过滤器销毁");
    }
}
